﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="BFOAuction._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

   <script type="text/javascript">  
    function doSomething(e) {
        $.get("Auction/UserAuction.aspx", function (data) {
            var arrL = $("#MainContent_MainProduct .LeftTime")[e];
            $(arrL).html(LoadTime(data));
        });
        };
        function LoadTime(leave) {
            var hour = Math.floor(leave / 3600);
            var minute = Math.floor(leave / 60) - (hour * 60);
            var second = Math.floor(leave) - (hour * 60 * 60) - (minute * 60);
            hour = hour < 10 ? "0" + hour : hour;
            minute = minute < 10 ? "0" + minute : minute;
            second = second < 10 ? "0" + second : second;
            var remain = hour + ":" + minute + ":" + second;
            return remain;
        };
    </script>

    <div id="MainProduct" runat="server">
    </div>

    <script type="text/javascript">
        CounterTimer();
        var interv = setInterval(CounterTimer, 1000);
        function CounterTimer() {
            var arr = $("#MainContent_MainProduct .LeftTime");
            var leave;
            $.each(arr, function () {

                var leaveList = $(this).html().split(":");
                leave = (parseInt(leaveList[0]) * 3600 + parseInt(leaveList[1]) * 60 + parseInt(leaveList[2])) - 1;
                if (leave == 40) {
                    location.reload(true);

                }
                var s = LoadTime(leave);
                $(this).html(s);
            });
        }
</script>   

</asp:Content>
